package com.atguigu.serviceedu.controller.site;

import com.atguigu.serviceedu.entity.EduCourse;
import com.atguigu.serviceedu.entity.EduTeacher;
import com.atguigu.serviceedu.service.EduCourseService;
import com.atguigu.serviceedu.service.EduTeacherService;
import com.atguigu.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/site/index")
public class SiteIndexController {
    @Autowired
    private EduTeacherService eduTeacherService;
    @Autowired
    private EduCourseService eduCourseService;
    @GetMapping("/getSiteIndexInfo")
    public ResultVO getIndexInfo(){
        List<EduCourse> courses = eduCourseService.queryCourseForSiteIndex();
        List<EduTeacher> teachers = eduTeacherService.queryTeacherForSiteIndex();
        return ResultVO.ok().Msg("获取网站首页信息成功").Data("courses",courses).Data("teachers",teachers);
    }
}
